import requests
import urllib3

# Disable SSL warnings if needed (use with caution)
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

url = "http://211.84.64.251/eportal/InterFace.do?method=login"

headers = {
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:138.0) Gecko/20100101 Firefox/138.0",
    "Accept": "*/*",
    "Accept-Language": "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2",
    "Accept-Encoding": "gzip, deflate",
    "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
    "Origin": "http://211.84.64.251",
    "Connection": "keep-alive",
    "Referer": "http://211.84.64.251/eportal/index.jsp?wlanuserip=10.101.80.229&wlanacname=SQSY_S18010&ssid=&nasip=211.84.64.1&snmpagentip=&mac=00919e465307&t=wireless-v2-plain&url=http://123.123.123.123/&apmac=&nasid=SQSY_S18010&vid=562&port=222&nasportid=AggregatePort^%^2034.05620000:562-0",
    "Cookie": "EPORTAL_COOKIE_PASSWORD=0bef6b57cfd691bea20a46d9f3e9e961fe48636e58022bdb63574b840014876865d81584161883badf39db3fd41f80183ec879603d0225fbe34b448e4a951b3015ab1a2d683b66b15106b34d192bb28821397f24fdad7ab0ef9be1c294077e0549cf77813402581058a41d592e19e39d7a67b72ba0906eee099adb77d858f093; EPORTAL_COOKIE_USERNAME=2247102148; EPORTAL_COOKIE_OPERATORPWD=; EPORTAL_COOKIE_SERVER=; EPORTAL_COOKIE_SERVER_NAME=; EPORTAL_COOKIE_NEWV=true; EPORTAL_AUTO_LAND=; EPORTAL_USER_GROUP=INC^%^E5^%^AD^%^A6^%^E7^%^94^%^9F; EPORTAL_COOKIE_DOMAIN=; EPORTAL_COOKIE_SAVEPASSWORD=true; JSESSIONID=3263E79EF90360340F20CA01A72B60A1",
    "Priority": "u=0"
}

data = "userId=2247102148&password=0bef6b57cfd691bea20a46d9f3e9e961fe48636e58022bdb63574b840014876865d81584161883badf39db3fd41f80183ec879603d0225fbe34b448e4a951b3015ab1a2d683b66b15106b34d192bb28821397f24fdad7ab0ef9be1c294077e0549cf77813402581058a41d592e19e39d7a67b72ba0906eee099adb77d858f093&service=&queryString=wlanuserip^%^253D10.101.80.229^%^2526wlanacname^%^253DSQSY_S18010^%^2526ssid^%^253D^%^2526nasip^%^253D211.84.64.1^%^2526snmpagentip^%^253D^%^2526mac^%^253D00919e465307^%^2526t^%^253Dwireless-v2-plain^%^2526url^%^253Dhttp^%^253A^%^252F^%^252F123.123.123.123^%^252F^%^2526apmac^%^253D^%^2526nasid^%^253DSQSY_S18010^%^2526vid^%^253D562^%^2526port^%^253D222^%^2526nasportid^%^253DAggregatePort^%^25252034.05620000^%^253A562-0&operatorPwd=&operatorUserId=&validcode=&passwordEncrypt=true"

try:
    response = requests.post(url, headers=headers, data=data, verify=False) # verify=False is used because it's an http:// address and might not have a valid certificate

    # Print the response status code and content
    print(f"Status Code: {response.status_code}")
    print("Response Body:")
    print(response.text)

    # You can also access response.json() if the response is JSON

except requests.exceptions.RequestException as e:
    print(f"An error occurred: {e}")